#include <stdio.h>
#include <avr/io.h>
#include <avr/delay.h>

#define LEDS_SUPERIOR 0xF0
#define TIME 100

int
main (void) {

	unsigned char aux = 0xFF;
	unsigned char value = 0xFF;

	DDRD = 0xFF;
	DDRB = 0x00;

	while (1) {

		aux = PINB;
		_delay_ms(300);

		switch (aux) {
			case 0xFE:
				value = (value << 1);
				break;
			case 0xFD:
				value = (value >> 1)|0x80;
				break;
			case 0xFB:
				value = 0xFF;
				break;
			default:
				break;
		}
		PORTD = value;
	}
}
